// var baseUrl = window.location.origin + '/'
if (window.location.host === 'api.vodeshop.com') {  // 正式
  var baseUrl = 'https://api.vodeshop.com/'
} else if(window.location.host == "love_back.test"){ // 测试
  var baseUrl = 'http://love_back.test/' // 本地路径后端测试自己注释还是干哈
}else{
    var baseUrl = 'https://test.api.vodeshop.com/'
}
/**
* 获取订阅
* @param {Int} id 众筹ID
*/
var getSubscriptionInfo = function (id = null) {
  if (id != null) {
    return axios.get(`${baseUrl}admin/api/live-subscription/get?id=${id}`)
  }
}
// 众筹商品接口
var getGoodsList = function (title = '') {
  return axios.get(`${baseUrl}admin/api/live-crowd-funds/goods`, { params: { q: title, size: 30, page: 1 } })
}
// 众筹活动接口
var getActList = function (title) {
  return axios.get(`${baseUrl}admin/api/live-crowd-funds/act`, { params: { q: title } })
}
// 订阅提交
var postSubscriptionAdd = function (data) {
  return axios.post(`${baseUrl}admin/api/live-subscription/add`, data)
}
// 订阅编辑
var editSubscriptionAdd = function (data) {
    return axios.post(`${baseUrl}admin/api/live-subscription/edit`, data)
}
// 获取七牛token
var qiniuUpToken = function () {
  return axios.get(`${baseUrl}api/qiniu-uptoken`)
}
// 上传文件
var qiniUpFile = function (data) {
  return axios({
    method: 'POST',
    url: 'https://up-z2.qiniup.com/',//上传地址
    data: data,
    timeout: 30000
  })
}
